<%@ page language="java" contentType="text/html; charset=gb2312"
    pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>java scipt</title>
</head>
<body>

<script type="text/javascript">
	
	function validate(form)
	{
		var username = form.username.value;
		var err = "";
		
		if(null == username || username == "")
		{
			err = "username is null!!!";		
		}
		
		if(err != "")
		{
			alert(err);
			return false;
		}
		else
		{
			return true;		
		}		
	}

</script> 


<form action="" onsubmit="return validate(this);">
	uername: <input type="text" name="username">
	<input type="submit" value="submit">
</form>


</body>
</html>